/**
 * 
 */
package com.ideeli.webextractor.domain;

import java.util.HashMap;
import java.util.Map;

/**
 * @author spaida
 *
 */
public class BlockAttributes 
{
	
	private float total;
	private Map<String,Integer> catCount;
	
	public BlockAttributes()
	{
		catCount= new HashMap<String,Integer>();
	}
	
	public float getTotal()
	{
		return total;
	}
	
	public void updateTotal(float value)
	{
		total=total+value;
	}
	
	/**
	 * 
	 * @param category
	 * @return true if category addition allowed otherwise false
	 */
	public boolean updateCategory(String category)
	{
		int count=0;
		
		if(catCount.get(category)!=null)
			count=catCount.get(category);
		
		if(count==3)//no more items of this cateogry
		{
			return false;
		}
		
		catCount.put(category, ++count);
		
		return true;
	}
	

}
